Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Take into account requirements for "isolate" or single-threaded runtimes #5284

Merged

Conversation

xdoardo
Copy link
Contributor

@xdoardo xdoardo commented Dec 5, 2024

V8 needs Wasm entities to be created in the same thread they run in. This PR moves the creation of said entities down to the task_wasm function in WASIX.

Caveats

This depends on a build of V8 with shared memory, which is not available yet - that is, running the precise code in this PR with wordpress won't work (again, because the wasm_c_api implementation of V8 does not support shared memories)

lib/api/src/entities/engine/inner.rs Show resolved Hide resolved
lib/api/src/entities/store/inner.rs Outdated Show resolved Hide resolved
let store_ref = store.as_store_ref();
let v8_store = store_ref.inner.store.as_v8();

if v8_store.thread_id != std::thread::current().id() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is used a lot... how about making it a method?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lib/wasix/src/runtime/task_manager/tokio.rs Outdated Show resolved Hide resolved
lib/api/src/rt/jsc/entities/engine.rs Show resolved Hide resolved
@xdoardo xdoardo linked an issue Dec 6, 2024 that may be closed by this pull request
@xdoardo xdoardo requested a review from theduke January 15, 2025 15:03
@xdoardo xdoardo marked this pull request as ready for review January 15, 2025 15:03
@xdoardo xdoardo requested a review from syrusakbary as a code owner January 15, 2025 15:03
This is necessary because `clap` does not like when `conflicts_with_all`
contains non-existing flags, and makes execution fail in debug mode.
@xdoardo xdoardo force-pushed the 5278-runtime-take-into-account-single-threaded-requirements branch from 6ae638b to 73a27fa Compare January 16, 2025 14:09
@xdoardo xdoardo merged commit afb6091 into wasmer-5.1.0 Jan 17, 2025
68 of 69 checks passed
@xdoardo xdoardo deleted the 5278-runtime-take-into-account-single-threaded-requirements branch January 17, 2025 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Runtime: take into account single-threaded requirements
2 participants